<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增OBU升级文件')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-obuupdata-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">OBU升级文件名：</label>
            <div class="col-sm-8">
                <input name="obufileName" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">OBU升级文件版本：</label>
            <div class="col-sm-8">
                <input name="obufileVersion" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">OBU升级地址：</label>
            <div class="col-sm-8">
                <input type="hidden" name="obufileAddress">
                <div class="file-loading">
                    <input class="form-control file-upload" id="obufileAddress" name="file" type="file">
                </div>
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-3 control-label">OBU厂家：</label>
            <div class="col-sm-8">

                <div class="radio-item">
                    <label class="radio-label">
                        <input type="radio" value="聚利" name="obufileFactory" checked>
                        <i></i>
                        <span>聚利 </span>
                    </label>
                </div>
                <div class="radio-item">
                    <label class="radio-label">
                        <input type="radio" value="金溢" name="obufileFactory">
                        <i></i>
                        <span>金溢</span>
                    </label>
                </div>


            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-3 control-label">时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="time" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "obufile/obuupdata"
    $("#form-obuupdata-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-obuupdata-add').serialize());
        }
    }

    $("input[name='time']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $(".file-upload").fileinput({
        uploadUrl: ctx + 'common/upload',
        allowedFileExtensions: ["jl2","bin"],
        maxFileCount: 1,
        autoReplace: true
    }).on('fileuploaded', function (event, data, previewId, index) {
        $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
    }).on('fileremoved', function (event, id, index) {
        $("input[name='" + event.currentTarget.id + "']").val('')
    })
</script>
</body>
</html>s